package com.wqm.batis.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wqm.batis.common.PageVo;
import com.wqm.batis.domain.HelloOrder;
import com.wqm.batis.mapper.HelloOrderMapper;
import com.wqm.batis.service.HelloOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * example表的注释 服务实现类
 *
 * @author: 王钦民
 * @date : 2023-12-18
 * @description: 一起变好吧
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class HelloOrderServiceImpl extends ServiceImpl<HelloOrderMapper, HelloOrder> implements HelloOrderService {

    @Resource
    private HelloOrderMapper helloOrderMapper;

    /**
     * 查询-分页查询
     *
     * @param page
     * @param pageSize
     * @return
     */
    @Override
    public PageVo<HelloOrder> getPageList(Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize, true);
        List<HelloOrder> list = helloOrderMapper.selectList(null);
        PageInfo<HelloOrder> pageInfo = new PageInfo<>(list);
        // 手动获取总记录数
        return PageVo.convertPageInfo(pageInfo);
    }

}
